//
//  LDClassRoomCell.m
//  Gift
//
//  Created by 李迪 on 15/11/18.
//  Copyright © 2015年 dllo. All rights reserved.
//

#import "LDClassRoomCell.h"
#import "BaseHeader.h"
#import "LDArtifactModel.h"

@interface LDClassRoomCell ()

@property (nonatomic, retain)UIImageView *image;
@property (nonatomic, retain)UILabel *title;


@end

@implementation LDClassRoomCell


-(void)dealloc{
    
    [self.image release];
    [self.title release];
    
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}



- (void)createCell{
    
    self.image = [[UIImageView alloc]init];
    self.image.layer.cornerRadius = 40;
    self.image.layer.masksToBounds = YES;
    [self addSubview:self.image];
    
    self.title = [[UILabel alloc]init];
    [self addSubview:self.title];
    
    [self.image release];
    [self.title release];
}

- (void)layoutSubviews{
    
    self.image.frame = CGRectMake(0, 10, 80, 80);
    self.title.frame = CGRectMake(SCREEN_WIDTH - 100, 80, 80, 20);
    
}

- (void)setModel:(LDArtifactModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.image sd_setImageWithURL:[NSURL URLWithString:model.avatar]];
    self.title.text = model.teacher_tag;
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
